<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- books.jsp -->

<%-- JSP page settings --%>
<%@
page language = "java"
     import = "clases.*, java.util.*"
     session = "true"
     %>
<jsp:useBean id="BookBean" class="clases.BookBean" scope="page" />
<!-- begin document -->
<html xmlns = "http://www.w3.org/1999/xhtml">

    <head>
        <title>Lista de Productos</title>

        <link rel = "stylesheet" href = "styles.css"
              type = "text/css" />
    </head>

    <body>
        <p class = "bigFont">Lista de Productos</p>

        <p class = "bold">Click en el enlace para ver detalles del producto</p>

        <p>

            <%-- begin JSP scriptlet to create list of books --%>
            <%! BookBean currentBook;%>
            <%

                // obtengo los titulos
                List titles = (List) request.getAttribute("titles");

                // obtain an Iterator to the set of keys in the List
                Iterator iterator = titles.iterator();

               // use the Iterator to get each BookBean and create
                // a link to each book
                while (iterator.hasNext()) {
                    currentBook = (BookBean) iterator.next();
            %>
            <jsp:setProperty name="BookBean" property="ISBN" value="<%=currentBook.getISBN()%>"/>
            <jsp:setProperty name="BookBean" property="title" value="<%=currentBook.getTitle()%>"/>
            <jsp:setProperty name="BookBean" property="editionNumber" value="<%=currentBook.getEditionNumber()%>"/> 
            <%-- end scriptlet to insert literal XHTML and --%>
            <%-- JSP expressions output from this loop     --%>

            <%-- link to a book's information --%>
            <span class = "bold">
                <a href =
                   "Prueba?isbn=<jsp:getProperty  name="BookBean" property="ISBN"/> ">

                    <jsp:getProperty  name="BookBean" property="title"/> 
                    <jsp:getProperty  name="BookBean" property="editionNumber"/>  
                </a>
            </span><br />

            <% // continue scriptlet

                }   // end while loop

            %> <%-- end scriptlet --%>

        </p>
    </body>

</html>